Dictionary Entry Programming Language Version
[show modes: view edit]

[begin mode part][getv("part");][end mode part]

[begin mode title][$_title]
[end mode title]

[begin mode compare]
[
	$l = editdistance($_title, $_args[0]);
	if($l == 0) {
		<li><a href="/?id=[$_id]"><u><b title="distance: [$l]">[$_title]</b></u></a></li>
	} else if($l < $_args[1]) {
		<li><a href="/?id=[$_id]"><span title="distance: [$l]">[$_title]</span></a></li>
	};
]
[end mode compare]

[begin mode fulldesc]
[
	$d = getv("definition");
	_wiki_format($d, "inline");
]
[end mode fulldesc]

[begin mode desc]
[
	$d = getv("definition");
	$pos = strpos($d, ".");
	if(substr($d, $pos + 1, 1) == ")") $pos = $pos + 1;
	_wiki_format(substr($d, 0, 1 + $pos), "inline");
]
[end mode desc]

[begin mode category_abbr]
[end mode category_abbr]

[begin mode autorepair]
[if(strpos($_body, "</") != "-1") {<p><b>Warning: HTML still present in <a href="/?id=[$_id]">[$_title]</a>.</b></p>};]
[end mode autorepair]

[begin mode validate]
[
$st = substr($_title, "-1");

if(getv("part") == "n") {[
	if($st == "a") $st = "u";
	if($st == "o") $st = "u";
	if($st == "e") $st = "u";
	if($st != "u") {
		<p><b>Warning: <a href="/?id=[$_id]">[$_title]</a> is not a noun in Lilitika.</b></p>
	};
]};

if(getv("part") == "v") {[
	if($st == "a") $st = "u";
	if($st == "o") $st = "u";
	if($st == "e") $st = "u";
	if($st == "u") {
		<p><b>Warning: <a href="/?id=[$_id]">[$_title]</a> is a noun in Lilitika but has been categorized as a verb.</b></p>
	};
]};

]
[end mode validate]

[begin mode export]
[
edit_display($_title);
chr(9);
edit_display(replace(replace(getv("categories"), chr(10), ","), chr(13), ""));
chr(9);
edit_display(getv("definition"));
]
[end mode export]

[begin mode entry_abbr]
	<b><a new href="/?id=[$_id]">[$_title]</a></b>.
	<i>[getv("part");]</i>.
[	
	$d = getv("definition");
	$pos = strpos($d, ".");
	if(substr($d, $pos + 1, 1) == ")") $pos = $pos + 1;
	_wiki_format(substr($d, 0, 1 + $pos), "inline");
]<br>
[end mode entry_abbr]

[begin mode abbr]
	<b><a new href="/?id=[$_id]">[$_title]</a></b>.
	<i>[getv("part");]</i>.
[
	$d = getv("definition");
	$pos = strpos($d, ".");
	if(substr($d, $pos + 1, 1) == ")") $pos = $pos + 1;
	_wiki_format(substr($d, 0, 1 + $pos), "inline");
]<br>
[end mode abbr]

[begin mode view]
	<p><b>[$_title]</b>. <i>[getv("part");]</i>. [_wiki_format(getv("definition"), "inline")]</p>
[$c = getv("categories");
if($c) {
<h2>Categories</h2>
<ul>
[
	$cat = title2id("Dictionary Category");
	$foo = foreach($c) {[
		$_data = replace($_data, chr(13), "");
		$id = search("id", "parent", $_parent, "title", $_data, "template", $cat);
		if($id == "") {[
			$_data = {<li><i>[$_data]</i></li>};
		]} else {[
			$_data = {<li><a href="/?id=[$id]">[$_data]</a></li>};
		]};
	]};
	print($foo);
]
</ul>
};]
[end mode view]

[begin mode edit]
<div>
<form method="post" action="/">
	<style type="text/css">
		.textbox {
			width: 50%;
		}
	</style>
	<input type="hidden" name="id" value="[$_id]">
	<input type="hidden" name="mode" value="submit">
	<input name="title" value="[edit_display($_title)]" style="width: 100%;"> (Title)<br>
	<textarea style="width: 100%;" name="definition">[
edit_display(getv("definition"))
]</textarea> (Definition)<br>
	<textarea style="width: 100%;" name="categories">[edit_display(getv("categories"))]</textarea> (Categories)<br>
	[$parts = {base<!>Language Core Function
ext<!>Extension Function
var<!>Environmental Variable
obj<!>Supplied Object
lang<!>Core Syntax};

_select(getv("part"), $parts, "part", {width: 100%;});] (Type)<br>
	<input type="submit" value="Submit">
</form>
</div>

<a href="/?id=[$_id]&mode=setup">Entry setup</a>
[end mode edit]

[begin mode submit]
[
	$_title = $_params.title;
	putv("definition", $_params.definition);
	putv("part", $_params.part);
	putv("categories", $_params.categories);
	msg_start();]
	It's done.<br>
		<a href="/?[$_title]">Go back?</a><br>
		<a href="/?id=[$_parent]&mode=add_entry">Add another?</a><br>
		<a href="/?id=[$_parent]">Return to dictionary?</a>
	[msg_end();]
[end mode submit]

[begin mode setup]
<form method="post" action="/">
	<input type="hidden" name="id" value="[$_id]"><br>
	<input type="hidden" name="mode" value="setup_submit"><br>
	<input class="textbox" name="template" value="[$_template]"> (Template)<br>
	<input class="textbox" name="author" value="[$_author]"> (Author)<br>
	<input class="textbox" name="permissions" value="[$_permissions]"> (Permissions)<br>
	<input class="textbox" name="parent" value="[$_parent]"> (Parent)<br>
	<span class="buttonbox"><input type="submit" value="Submit"></span>
</form>
[end mode setup]

[begin mode setup_submit]
[
	$_template = $_params.template;
	$_author = $_params.author;
	$_permissions = $_params.permissions;
	$_parent = $_params.parent;
	msg_start();]
	It's done. <a href="/?[$_title]">Go back</a> or <a href="/?id=[$_parent]">to parent</a>.
	[msg_end();]
[end mode setup_submit]

[begin mode category_query]
[$_cr = {
}][$_id]:.[replace(replace(getv("categories"), $_cr, "."), chr(10), ".")].
[end mode category_query]